Initialize snow model
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | inifile |
stores configuration information |
||
type(grid_integer), | intent(in) | :: | mask | |||
type(DateTime), | intent(in) | :: | time |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(IniList), | public | :: | iniDB | ||||
integer(kind=short), | public | :: | iscalar | ||||
real(kind=float), | public | :: | scalar |
SUBROUTINE SnowInit & ! (inifile, mask, time) IMPLICIT NONE !Arguments with intent(in): CHARACTER (LEN = *), INTENT(IN) :: inifile !!stores configuration information TYPE (grid_integer), INTENT(IN) :: mask TYPE (DateTime), INTENT(IN) :: time !local declarations: TYPE (IniList) :: iniDB REAL (KIND = float) :: scalar INTEGER (KIND = short) :: iscalar !---------------------end of declarations-------------------------------------- !open and read configuration file CALL IniOpen (inifile, iniDB) !load melt model IF (SectionIsPresent('melt-model', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'melt-model') ) THEN iscalar = IniReadInt ('scalar', iniDB, 'melt-model') CALL NewGrid (meltModel, mask, iscalar) ELSE CALL GridByIni (iniDB, meltModel, section = 'melt-model') END IF ELSE CALL Catch ('error', 'Snow', & 'melt-model not found in configuration file' ) END IF !set melt coefficient IF (SectionIsPresent('melt-coefficient', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'melt-coefficient') ) THEN scalar = IniReadReal ('scalar', iniDB, 'melt-coefficient') CALL NewGrid ( meltCoefficient, mask, scalar ) ELSE CALL GridByIni (iniDB, meltCoefficient, & section = 'melt-coefficient', & time = time ) END IF ELSE CALL Catch ('error', 'Snow', & 'melt-coefficient not found in configuration file' ) END IF !set threshold temperature for melt starts (°C) IF (SectionIsPresent('melt-threshold-temperature', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'melt-threshold-temperature') ) THEN scalar = IniReadReal ('scalar', iniDB, 'melt-threshold-temperature') CALL NewGrid ( meltTemperature, mask, scalar ) ELSE CALL GridByIni (iniDB, meltTemperature, & section = 'melt-threshold-temperature', & time = time ) END IF ELSE CALL Catch ('error', 'Snow', & 'melt-threshold-temperature not found in configuration file' ) END IF !set upper temperature for partitioning precipitation (°C) IF (SectionIsPresent('partitioning-upper-temperature', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'partitioning-upper-temperature') ) THEN scalar = IniReadReal ('scalar', iniDB, 'partitioning-upper-temperature') CALL NewGrid ( upperTemperature, mask, scalar ) ELSE CALL GridByIni (iniDB, upperTemperature, & section = 'partitioning-upper-temperature', & time = time ) END IF ELSE CALL Catch ('error', 'Snow', & 'partitioning-upper-temperature not found in configuration file' ) END IF !set lower temperature for partitioning precipitation (°C) IF (SectionIsPresent('partitioning-lower-temperature', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'partitioning-lower-temperature') ) THEN scalar = IniReadReal ('scalar', iniDB, 'partitioning-lower-temperature') CALL NewGrid( lowerTemperature, mask, scalar ) ELSE CALL GridByIni (iniDB, lowerTemperature, & section = 'partitioning-lower-temperature', & time = time ) END IF ELSE CALL Catch ('error', 'Snow', & 'partitioning-lower-temperature not found in configuration file' ) END IF !set snow hydraulic conductivity (m/s) IF (SectionIsPresent('hydraulic-conductivity', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'hydraulic-conductivity') ) THEN scalar = IniReadReal ('scalar', iniDB, 'hydraulic-conductivity') CALL NewGrid ( snowConductivity, mask, scalar ) ELSE CALL GridByIni ( iniDB, snowConductivity, & section = 'hydraulic-conductivity', & time = time ) END IF ELSE CALL Catch ('error', 'Snow', & 'hydraulic-conductivity not found in configuration file' ) END IF !set refreezing coefficient (-) IF (SectionIsPresent('refreezing-coefficient', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'refreezing-coefficient') ) THEN scalar = IniReadReal ('scalar', iniDB, 'refreezing-coefficient') CALL NewGrid ( cRefreeze, mask, scalar ) ELSE CALL GridByIni ( iniDB, cRefreeze, & section = 'refreezing-coefficient' ) END IF ELSE !set default value CALL NewGrid ( cRefreeze, mask, 0.05 ) END IF !set snow water holding capacity (-) IF (SectionIsPresent('water-holding-capacity', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'water-holding-capacity') ) THEN scalar = IniReadReal ('scalar', iniDB, 'water-holding-capacity') CALL NewGrid ( swhc, mask, scalar ) ELSE CALL GridByIni ( iniDB, swhc, & section = 'water-holding-capacity' ) END IF ELSE !set default value CALL NewGrid ( swhc, mask, 0.1 ) END IF !set initial optional variables !swe IF (SectionIsPresent('snow-water-equivalent', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'snow-water-equivalent') ) THEN scalar = IniReadReal ('scalar', iniDB, 'snow-water-equivalent') CALL NewGrid ( swe, mask, scalar ) ELSE CALL GridByIni (iniDB, swe, section = 'snow-water-equivalent') END IF ELSE !set to default = 0 CALL NewGrid ( swe, mask, 0. ) END IF !water in snow IF (SectionIsPresent('water-in-snow', iniDB)) THEN IF (KeyIsPresent ('scalar', iniDB, 'water-in-snow') ) THEN scalar = IniReadReal ('scalar', iniDB, 'water-in-snow') CALL NewGrid ( waterInSnow, mask, scalar ) ELSE CALL GridByIni (iniDB, waterInSnow, section = 'water-in-snow') END IF ELSE !set to default = 0 CALL NewGrid ( waterInSnow, mask, 0. ) END IF !Configuration terminated. Deallocate ini database CALL IniClose (iniDB) !allocate variables CALL NewGrid ( excessWaterSnowFlux, mask, 0. ) CALL NewGrid ( snowMelt, mask, 0. ) CALL NewGrid ( QinSnow, mask, 0. ) CALL NewGrid ( QoutSnow, mask, 0. ) RETURN END SUBROUTINE SnowInit